package com.iwomy.secureplat.platform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iwomy.secureplat.platform.entity.AlarmDetectionTypeEntity;
import com.iwomy.secureplat.platform.enumeration.StateEnum;
import com.iwomy.secureplat.platform.mapper.AlarmDetectionTypeMapper;
import com.iwomy.secureplat.platform.service.AlarmDetectionTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 报警事件类型
 *
 * @author pig
 * @date 2023-12-22 10:10:01
 */
@Service
public class AlarmDetectionTypeServiceImpl extends ServiceImpl<AlarmDetectionTypeMapper, AlarmDetectionTypeEntity> implements AlarmDetectionTypeService {
	@Override
	public List<AlarmDetectionTypeEntity> listBySensorIds(List<String> sensorIds) {

		LambdaQueryWrapper<AlarmDetectionTypeEntity> queryWrapper = Wrappers.lambdaQuery();
		queryWrapper.eq(AlarmDetectionTypeEntity::getState, StateEnum.ENABLE.getVal());
		queryWrapper.in(AlarmDetectionTypeEntity::getSensorTypeCode, sensorIds);
		return this.list(queryWrapper);
	}
}